//
//  InpatientViewController.m
//  掌上宏力
//
//  Created by admin on 2017/4/26.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "InpatientViewController.h"
#import "InpHealthyVC.h"
#import "CheckInfoViewController.h"
#import "TestInfoViewController.h"
#import "InpOperationVC.h"
#import "InpCostsDetailVC.h"
#import "InpatientViewModel.h"

@interface InpatientViewController ()

@property (nonatomic,strong) InpatientViewModel *viewModel;

@end

@implementation InpatientViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"住院信息";
}

-(void)getDatasArray{
    [self getDatasArray:^(GetDatas handler) {
        _viewModel = [[InpatientViewModel alloc] init];
        [_viewModel getInpatientViewList:^{
            handler(_viewModel.datasArray);
        }];
    }];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    switch (indexPath.section) {
        case 0:{
            InpHealthyVC *healthVC = [[InpHealthyVC alloc] init];
            [self pushViewControllerTo:healthVC];
        }
            break;
        case 1:{
            CheckInfoViewController *checkVC = [[CheckInfoViewController alloc] init];
            checkVC.patientSource = @"2";
            checkVC.title = @"住院检查";
            [self pushViewControllerTo:checkVC];
        }
            break;
        case 2:{
            TestInfoViewController *testVC = [[TestInfoViewController alloc] init];
//            testVC.flag = @"1";
            testVC.title = @"住院检验";
            [self pushViewControllerTo:testVC];
        }
            break;
        case 3:{
            InpOperationVC *operVC = [[InpOperationVC alloc] init];
            [self pushViewControllerTo:operVC];
        }
            break;
        case 4:{
            InpCostsDetailVC *costVC = [[InpCostsDetailVC alloc] init];
            [self pushViewControllerTo:costVC];
        }
            break;
   
        default:
            break;
    }
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellId = @"cellId";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
    }
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.text = _viewModel.datasArray[indexPath.section];
    return cell;
}

@end
